package com.zhijian.warehouse.manage.entity.vo.response;

import com.zhijian.util.BeanUtil;
import com.zhijian.warehouse.manage.enums.ProductEnum;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;

/**
 * 出库产品明细表 回显vo
 *
 * @author auto
 * @version 1.0
 * @date 2024-10-27 13:45:55
 */
@Data
@Api(tags = "出库产品明细表回显vo")
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class StoreOutRecordProductVo implements Serializable {

    private static final long serialVersionUID = -1;

    /**
     * 主键ID
     */
    @ApiModelProperty("主键ID")
    private Long id;

    /**
     * 出库单ID
     */
    @ApiModelProperty("出库单ID")
    private Long storeOutRecordId;

    /**
     * 产品ID
     */
    @ApiModelProperty("产品ID")
    private Long productId;

    /**
     * 出库数目
     */
    @ApiModelProperty("出库数目")
    private BigDecimal storeCount;

    /**
     * 仓库ID
     */
    @ApiModelProperty("仓库ID")
    private Long warehouseId;

    /**
     * 库位ID
     */
    @ApiModelProperty("库位ID")
    private Long warehouseLocationId;

    /**
     * 创建时间
     */
    @ApiModelProperty("创建时间")
    private String createTime;

    /**
     * 修改时间
     */
    @ApiModelProperty("修改时间")
    private String updateTime;

    @ApiModelProperty("产品名称")
    private String productName;
    @ApiModelProperty("产品编码")
    private String productNumber;
    @ApiModelProperty("产品rfid码")
    private String productRfId;
    @ApiModelProperty("产品型号")
    private String productModel;
    @ApiModelProperty("产品备注")
    private String productNote;
    @ApiModelProperty("产品 状态，1：正常，2：故障，3：作废")
    private Byte productStatus;
    @ApiModelProperty("产品 状态 字符串")
    private String productStatusStr;
    @ApiModelProperty("发卡状态，1：已发卡，0：未发卡")
    private Byte productCardStatus;
    @ApiModelProperty("发卡状态字符串")
    private String productCardStatusStr;
    @ApiModelProperty("品类")
    private String categoryName;
    @ApiModelProperty("单位名称")
    private String unitName;
    @ApiModelProperty("库位")
    private String warehouseLocationName;

    @ApiModelProperty("仓库名称")
    private String warehouseName;

    @ApiModelProperty("包含库位信息的仓库列表")
    private List<StoreWarehouseVo> storeWarehouseVos;

    public String getProductCardStatusStr() {
        if (BeanUtil.isNotEmpty(this.productCardStatus) && ProductEnum.CardStatusEnum.getByCode(Integer.valueOf(this.productCardStatus)) != null)
            return ProductEnum.CardStatusEnum.getByCode(Integer.valueOf(this.productCardStatus)).getDesc();
        return productCardStatusStr;
    }

    public String getProductStatusStr() {
        if (BeanUtil.isNotEmpty(this.productStatus) && ProductEnum.StatusEnum.getByCode(Integer.valueOf(this.productStatus)) != null)
            return ProductEnum.StatusEnum.getByCode(Integer.valueOf(this.productStatus)).getDesc();
        return productStatusStr;
    }
}
